package com.fone.player.entity;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

/**
 * 
 * 通知实体类
 * 
 * @author wangyang
 * @since 2014年5月14日
 */
public class NotificationBean implements Parcelable {
	/**
	 * 通知类型
	 */
	public static final int NOTIFICATION_TYPE = 0;
	/**
	 * 消息类型
	 */
	public static final int INFORMATION_TYPE = 1;
	/**
	 * 系统通知
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_SYSTEM = 1;
	/**
	 * 精彩影讯
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_FILM_NEWS = 2;
	/**
	 * 热剧追播
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_HOT_DRAMA = 3;
	/**
	 * 更多精彩
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_MORE = 4;
	/**
	 * 评论回复
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_COMMENT_REPLY = 5;
	/**
	 * 用户反馈回复
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_FEED_BACK_REPLY = 6;
	/**
	 * 礼包通知
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_GIFT = 7;
	/**
	 * 计费通知
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_BILLING = 8;
	/**
	 * 活动通知
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_ACTIVITIES = 9;
	/**
	 * 充值通知
	 */
	public static final int NOTIFICATION_CONTENT_TYPE_RECHARGE = 10;
	/**
	 * 图片+文字形式
	 */
	public static final int NOTIFICATION_CONTENT_PATTERN_TYPE_IMAGE_TEXT = 1;
	/**
	 * 纯文字链接形式
	 */
	public static final int NOTIFICATION_CONTENT_PATTERN_TYPE_TEXT_URL = 2;
	/**
	 * 纯文字无链接形式
	 */
	public static final int NOTIFICATION_CONTENT_PATTERN_TYPE_TEXT_NO_URL = 7;
	/**
	 * 系统通知栏展现
	 */
	public static final int NOTIFICATION_SHOW_TYPE_SYSTEM = 1;
	/**
	 * 通知弹框展现
	 */
	public static final int NOTIFICATION_SHOW_TYPE_DIALOG = 2;
	/**
	 * 直接播放
	 */
	public static final int NOTIFICATION_PLAY_TYPE_DIRECT = 1;
	/**
	 * 去原网页
	 */
	public static final int NOTIFICATION_PLAY_TYPE_WEB = 2;
	/**
	 * 访问播放接口
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_PLAY = 0;
	/**
	 * 访问详情页接口
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_DETAIL = 1;
	/**
	 * 打开大海报页
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_POSTER = 2;
	/**
	 * 打开 wap 网页
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_WAP = 3;
	/**
	 * 下载应用
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_APP = 4;
	/**
	 * 打开计费页面
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_BILLING = 5;
	/**
	 * 打开评论列表
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_COMMENT = 6;
	/**
	 * 打开原始网页
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_WEB = 8;
	/**
	 * 打开频道或专题
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_CHANNEL = 9;
	/**
	 * 打开内通知页面
	 */
	public static final int NOTIFICATION_EXTERNAL_TYPE_NOTIFICATIONVIEW = 10;
	// 消息id(自增长)
	private int mNotificationId;
	// 服务器端消息id
	private String mNotificationServerId;
	// 消息名称(name)
	private String mNotificationName;
	// 消息内容(desc)
	private String mNotificationContent;
	// 剧集名称(dname)
	private String mNotificationDramaName;
	// 消息类型(0通知,1消息)
	private int mNotificationType;
	// 消息内容类型(1 系统通知 ,2 精彩影讯,3 热剧追播,4 更多精彩,5 评论回复,6 用户反馈回复,7 礼包通知,8 计费通知)(qtp)
	private int mNotificationContentType;
	// 消息内容展示类型(type=1 图片+文字形式,type=2 纯文字链接形式,type=7 纯文字无链接形式)(type)
	private int mNotificationContentPatternType;
	// 外部通知展现形式(用户未设置时使用)(1 系统通知栏展现,2 通知弹框展现)(showtype)
	private int mNotificationShowType;
	// 消息播放类型(0直接播放,1去原网页)(toply)
	private int mNotificationPlayType;
	// 消息外链类型(0 访问播放接口,1 访问详情页接口,2 打开大海报页,3 打开 wap 网页,4 下载应用,5 打开计费页面,6 打开评论列表,8
	// 打开原始网页,9 打开频道或专题)(utp)
	private int mNotificationExternalType;
	// 节目清晰度(1标清,2高清,3超清,例如：1,2,3 表示同时存在标清、高清、超清)(dfnt)
	private String mNotificationDefinitionType;
	// 消息图片路径(posterpic)
	private String mNotificationImageUrl;
	// 消息图片路径(pic)
	private String mNotificationIconUrl;
	// 消息外链,原始页面地址(ourl)
	private String mNotificationExternalUrl;
	// 消息连接(utp参数指定的链接地址type=1,2 时存在)(url)
	private String mNotificationUrl;
	// 分享地址(weibourl)
	private String mNotificationShareUrl;
	// 消息创建时间
	private long mNotificationCreateTime;
	// 评论回复时间 utp=6 时有效(time)
	private String mNotificationCommentReplyTime;
	// 反馈时间
	private String mNotificationFeedBackTime;
	// 反馈内容
	private String mNotificationFeedBackDesc;
	// 消息是否已读
	private boolean mNotificationIsRead;
	// 消息是否已展示
	private boolean mNotificationIsShow;
	// 是否显示播放按钮( 0不显示, 1显示(默认))(btnply)
	private boolean mNotificationIsShowPlayButton;
	// 显示下载按钮(0不显示, 1显示(默认))(btndown)
	private boolean mNotificationIsShowDownloadButton;

	// 删除选中状态
	private boolean deleteSelected;

	public boolean isDeleteSelected() {
		return deleteSelected;
	}

	public void setDeleteSelected(boolean deleteSelected) {

		this.deleteSelected = deleteSelected;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
		out.writeInt(mNotificationId);
		out.writeString(mNotificationServerId);
		out.writeString(mNotificationName);
		out.writeString(mNotificationContent);
		out.writeString(mNotificationDramaName);
		out.writeInt(mNotificationType);
		out.writeInt(mNotificationContentType);
		out.writeInt(mNotificationContentPatternType);
		out.writeInt(mNotificationShowType);
		out.writeInt(mNotificationPlayType);
		out.writeInt(mNotificationExternalType);
		out.writeString(mNotificationDefinitionType);
		out.writeString(mNotificationImageUrl);
		out.writeString(mNotificationIconUrl);
		out.writeString(mNotificationExternalUrl);
		out.writeString(mNotificationUrl);
		out.writeString(mNotificationShareUrl);
		out.writeLong(mNotificationCreateTime);
		out.writeString(mNotificationCommentReplyTime);
		out.writeString(mNotificationFeedBackTime);
		out.writeString(mNotificationFeedBackDesc);
		out.writeInt(mNotificationIsRead ? 1 : 0);
		out.writeInt(mNotificationIsShow ? 1 : 0);
		out.writeInt(mNotificationIsShowPlayButton ? 1 : 0);
		out.writeInt(mNotificationIsShowDownloadButton ? 1 : 0);

	}

	public static final Parcelable.Creator<NotificationBean> CREATOR = new Parcelable.Creator<NotificationBean>() {
		@Override
		public NotificationBean createFromParcel(Parcel in) {
			return new NotificationBean(in);
		}

		@Override
		public NotificationBean[] newArray(int size) {
			return new NotificationBean[size];
		}
	};

	private NotificationBean(Parcel in) {
		mNotificationId = in.readInt();
		mNotificationServerId = in.readString();
		mNotificationName = in.readString();
		mNotificationContent = in.readString();
		mNotificationDramaName = in.readString();
		mNotificationType = in.readInt();
		mNotificationContentType = in.readInt();
		mNotificationContentPatternType = in.readInt();
		mNotificationShowType = in.readInt();
		mNotificationPlayType = in.readInt();
		mNotificationExternalType = in.readInt();
		mNotificationDefinitionType = in.readString();
		mNotificationImageUrl = in.readString();
		mNotificationIconUrl = in.readString();
		mNotificationExternalUrl = in.readString();
		mNotificationUrl = in.readString();
		mNotificationShareUrl = in.readString();
		mNotificationCreateTime = in.readLong();
		mNotificationCommentReplyTime = in.readString();
		mNotificationFeedBackTime = in.readString();
		mNotificationFeedBackDesc = in.readString();
		mNotificationIsRead = in.readInt() == 1;
		mNotificationIsShow = in.readInt() == 1;
		mNotificationIsShowPlayButton = in.readInt() == 1;
		mNotificationIsShowDownloadButton = in.readInt() == 1;
	}

	public String getNotificationServerId() {
		return mNotificationServerId == null ? "" : mNotificationServerId;
	}

	public void setNotificationServerId(String notificationServerId) {

		mNotificationServerId = notificationServerId;
	}

	public String getNotificationFeedBackTime() {
		return mNotificationFeedBackTime == null ? ""
				: mNotificationFeedBackTime;
	}

	public void setNotificationFeedBackTime(String notificationFeedBackTime) {

		mNotificationFeedBackTime = notificationFeedBackTime;
	}

	public String getNotificationFeedBackDesc() {
		return mNotificationFeedBackDesc == null ? ""
				: mNotificationFeedBackDesc;
	}

	public void setNotificationFeedBackDesc(String notificationFeedBackDesc) {

		mNotificationFeedBackDesc = notificationFeedBackDesc;
	}

	public boolean getNotificationIsShow() {
		return mNotificationIsShow;
	}

	public void setNotificationIsShow(boolean notificationIsShow) {

		mNotificationIsShow = notificationIsShow;
	}

	public int getNotificationId() {
		return mNotificationId;
	}

	public void setNotificationId(int notificationId) {

		mNotificationId = notificationId;
	}

	public String getNotificationName() {
		return mNotificationName == null ? "" : mNotificationName;
	}

	public void setNotificationName(String notificationName) {

		mNotificationName = notificationName;
	}

	public String getNotificationContent() {
		return mNotificationContent == null ? "" : mNotificationContent;
	}

	public void setNotificationContent(String notificationContent) {

		mNotificationContent = notificationContent;
	}

	public String getNotificationDramaName() {
		return mNotificationDramaName == null ? "" : mNotificationDramaName;
	}

	public void setNotificationDramaName(String notificationDramaName) {

		mNotificationDramaName = notificationDramaName;
	}

	/**
	 * 
	 * 获取通知类型
	 * 
	 * @return int 通知类型<br>
	 *         NotificationBean.NOTIFICATION_TYPE 通知类型<br>
	 *         NotificationBean.INFORMATION_TYPE 消息类型<br>
	 */
	public int getNotificationType() {
		return mNotificationType;
	}

	/**
	 * 
	 * 设置通知类型
	 * 
	 * @param int 通知类型<br>
	 *        NotificationBean.NOTIFICATION_TYPE 通知类型<br>
	 *        NotificationBean.INFORMATION_TYPE 消息类型<br>
	 */
	public void setNotificationType(int notificationType) {

		mNotificationType = notificationType;
	}

	/**
	 * 
	 * 获取通知内容类型(qtp)
	 * 
	 * @return int 通知类型<br>
	 *         NotificationBean.NOTIFICATION_TYPE 通知类型<br>
	 *         NotificationBean.INFORMATION_TYPE 消息类型<br>
	 */
	public int getNotificationContentType() {
		return mNotificationContentType;
	}

	public void setNotificationContentType(int notificationContentType) {

		mNotificationContentType = notificationContentType;
	}

	public int getNotificationContentPatternType() {
		return mNotificationContentPatternType;
	}

	public void setNotificationContentPatternType(
			int notificationContentPatternType) {

		mNotificationContentPatternType = notificationContentPatternType;
	}

	public int getNotificationShowType() {
		return mNotificationShowType;
	}

	public void setNotificationShowType(int notificationShowType) {

		mNotificationShowType = notificationShowType;
	}

	public int getNotificationPlayType() {
		return mNotificationPlayType;
	}

	public void setNotificationPlayType(int notificationPlayType) {

		mNotificationPlayType = notificationPlayType;
	}

	public int getNotificationExternalType() {
		return mNotificationExternalType;
	}

	public void setNotificationExternalType(int notificationExternalType) {

		mNotificationExternalType = notificationExternalType;
	}

	public String getNotificationDefinitionType() {
		return mNotificationDefinitionType == null ? ""
				: mNotificationDefinitionType;
	}

	public void setNotificationDefinitionType(String cacheDefinitionType) {

		mNotificationDefinitionType = cacheDefinitionType;
	}

	public String getNotificationImageUrl() {
		return mNotificationImageUrl == null ? "" : mNotificationImageUrl;
	}

	public void setNotificationImageUrl(String notificationImageUrl) {

		mNotificationImageUrl = notificationImageUrl;
	}

	public String getNotificationIconUrl() {
		return mNotificationIconUrl == null ? "" : mNotificationIconUrl;
	}

	public void setNotificationIconUrl(String notificationIconUrl) {

		mNotificationIconUrl = notificationIconUrl;
	}

	public String getNotificationExternalUrl() {
		return mNotificationExternalUrl == null ? "" : mNotificationExternalUrl;
	}

	public void setNotificationExternalUrl(String notificationExternalUrl) {

		mNotificationExternalUrl = notificationExternalUrl;
	}

	public String getNotificationUrl() {
		return mNotificationUrl == null ? "" : mNotificationUrl;
	}

	public void setNotificationUrl(String notificationUrl) {

		mNotificationUrl = notificationUrl;
	}

	public String getNotificationShareUrl() {
		return mNotificationShareUrl == null ? "" : mNotificationShareUrl;
	}

	public void setNotificationShareUrl(String notificationShareUrl) {

		mNotificationShareUrl = notificationShareUrl;
	}

	public long getNotificationCreateTime() {
		return mNotificationCreateTime;
	}

	public void setNotificationCreateTime(long notificationCreateTime) {

		mNotificationCreateTime = notificationCreateTime;
	}

	public String getNotificationCommentReplyTime() {
		return mNotificationCommentReplyTime == null ? ""
				: mNotificationCommentReplyTime;
	}

	public void setNotificationCommentReplyTime(
			String notificationCommentReplyTime) {

		mNotificationCommentReplyTime = notificationCommentReplyTime;
	}

	public boolean getNotificationIsRead() {
		return mNotificationIsRead;
	}

	public void setNotificationIsRead(boolean notificationIsRead) {

		mNotificationIsRead = notificationIsRead;
	}

	public boolean getNotificationIsShowPlayButton() {
		return mNotificationIsShowPlayButton;
	}

	public void setNotificationIsShowPlayButton(
			boolean notificationIsShowPlayButton) {

		mNotificationIsShowPlayButton = notificationIsShowPlayButton;
	}

	public boolean getNotificationIsShowDownloadButton() {
		return mNotificationIsShowDownloadButton;
	}

	public void setNotificationIsShowDownloadButton(
			boolean notificationIsShowDownloadButton) {

		mNotificationIsShowDownloadButton = notificationIsShowDownloadButton;
	}

	public NotificationBean() {

	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public boolean equals(Object o) {
		if (o instanceof NotificationBean) {
			NotificationBean notificationBean = (NotificationBean) o;
			if(TextUtils.isEmpty(notificationBean.mNotificationServerId)
					||TextUtils.isEmpty(mNotificationServerId)){
				return false;
			}
			return notificationBean.mNotificationServerId.equals(mNotificationServerId);
		}
		return false;
	}

	@Override
	public String toString() {
		return "NotificationBean [mNotificationId=" + mNotificationId
				+ ", mNotificationName=" + mNotificationName
				+ ", mNotificationContent=" + mNotificationContent
				+ ", mNotificationDramaName=" + mNotificationDramaName
				+ ", mNotificationType=" + mNotificationType
				+ ", mNotificationContentType=" + mNotificationContentType
				+ ", mNotificationContentPatternType="
				+ mNotificationContentPatternType + ", mNotificationShowType="
				+ mNotificationShowType + ", mNotificationPlayType="
				+ mNotificationPlayType + ", mNotificationExternalType="
				+ mNotificationExternalType + ", mNotificationDefinitionType="
				+ mNotificationDefinitionType + ", mNotificationImageUrl="
				+ mNotificationImageUrl + ", mNotificationIconUrl="
				+ mNotificationIconUrl + ", mNotificationExternalUrl="
				+ mNotificationExternalUrl + ", mNotificationUrl="
				+ mNotificationUrl + ", mNotificationShareUrl="
				+ mNotificationShareUrl + ", mNotificationCreateTime="
				+ mNotificationCreateTime + ", mNotificationCommentReplyTime="
				+ mNotificationCommentReplyTime
				+ ", mNotificationFeedBackTime=" + mNotificationFeedBackTime
				+ ", mNotificationFeedBackDesc=" + mNotificationFeedBackDesc
				+ ", mNotificationIsRead=" + mNotificationIsRead
				+ ", mNotificationIsShow=" + mNotificationIsShow
				+ ", mNotificationIsShowPlayButton="
				+ mNotificationIsShowPlayButton
				+ ", mNotificationIsShowDownloadButton="
				+ mNotificationIsShowDownloadButton + "]";
	}

}
